<jsp:useBean id="sessiondata" class="bibbletex.models.SessionData"
	scope="session" />

<%@ page
	import="bibbletex.models.*,java.util.UUID,java.util.List"
	import="bibbletex.views.CollaborationView,bibbletex.controllers.CollaborationController" %>	

<%
	String page_title = new String("Import references");
	String onloadjsfunction = "";
	boolean show_title = true;
	boolean show_navigation = true;
	String[] jstitle = {"collab", "import"};
	String import_type = "search";
	
	if (request.getParameter("type") != null
			&& request.getParameter("type").equals(
					"search")){
		import_type = "search";
	}
	else if (request.getParameter("type") != null
			&& request.getParameter("type").equals(
					"code")){
		import_type = "code";
	}
	else if (request.getParameter("type") != null
			&& request.getParameter("type").equals(
					"file")){
		import_type = "file";
	}
%>
<%@ include file="/header.jsp"%>
<div id="Content">
<% if (sessiondata.collaboration != null) { %>
	<div id="ContentCenter" class="clearfix">
	
	<div class="importNavigation clearfix"><ul>
			<li <% if (import_type.equals("search")) {%>
				class="current"<% } %>><a href="import.jsp?type=search">Search</a></li> 
			<li <% if (import_type.equals("code")) {%> class="current" <%}%> ><a
				href="import.jsp?type=code"
				>BibTex Code</a></li>
			<li <% if (import_type.equals("file")) {%> class="current" <%}%> ><a
				href="import.jsp?type=file"
				>BibTex File</a></li>	
				
		</ul></div>
		<div id="importContainer" class="clearfix">
	
<% if(import_type.equals("search")){ %>

<div id="importSearch">
<form name="searchform" class="clearfix" action="/collaboration/searchresults.jsp" method="post"  onsubmit="xmlhttpPost('/collaboration/searchresults.jsp', 'searchform','searchresults', '<div class=\'waitIcon\'><img src=\'/img/wait.gif\'></div>',true); return false;">

<input class="importSearch" type="text" name="searchterm" placeholder="Search terms" />
<input class="importSubmit" type="submit" name="search" value="Search" onclick="setOffset(0)"/>
<input class="importNext"  type="submit" name="next" value=">>" onclick="nextPage()"/>
<input class="importPrevious"  type="submit" name="previous" value="<<" onclick="previousPage()"/>
<input type="hidden" name="resultsoffset" id="resultsoffset" value="0" />
</form>
<span class="citeSeer"><a href="http://citeseerx.ist.psu.edu/index" title="CiteSeerX"><img src="/img/content/CiteSeerX.png" alt="CiteSeerX" /></a><em>powered by </em></span>
<div id="searchresults">&nbsp;</div>

</div>

<% } else if(import_type.equals("code")){ %>
<div id="importcode">
<form action="/collaboration/reference/process.jsp" method="post">
<label for="bibtexcode">Please paste here your BibTeX-formatted references</label>
<textarea name="bibtexcode" rows="10"></textarea>

<div class="form-line submit-center">
		<input type="submit" value="Save" />
	</div>
</form>
</div>

<% } else if(import_type.equals("file")){ %>
<div id="importfile">
<form enctype="multipart/form-data" action="/collaboration/reference/process.jsp" method="post">
<label for="fileupload">Upload a file:</label>
<input type="file" name="fileupload" />
		<input type="submit" value="Upload" />
</form>

</div>
<% } %>

</div>
</div>
<% } else { %>
<div class="error">Unable to load Collaboration.
<br />Please Contact our Support.</div>
<% } %>
</div>

<%@ include file="/footer.jsp"%>
